package io;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Stream;

public class TestFiles {
    public static void main(String[] args) throws IOException {
        List<String> strings = Files.readAllLines(Path.of("C:\\Users\\Sekla\\Desktop\\java_learn\\practice\\src\\io\\demo.txt"));
        System.out.println(strings);

        String str = new String(Files.readAllBytes(Path.of("C:\\Users\\Sekla\\Desktop\\java_learn\\practice\\src\\io\\demo.txt")));
        System.out.println(str);

        try(Stream<String> stream = Files.lines(Path.of("C:\\Users\\Sekla\\Desktop\\java_learn\\practice\\src\\io\\demo.txt"))) {
            stream.forEach(System.out::println);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
